//
//  IOS15ButtonStyleAPI.swift
//  SwiftUIButton
//
//  Created by 李煜 on 2024/7/31.
//

import SwiftUI

struct IOS15ButtonStyleAPI: View {
  var body: some View {
    // MARK: iOS 15  API设置按钮样式
    
    // iOS 15之前
    Button(action: {}, label: {
      Text("< iOS 15")
        .font(.title)
        .padding()
        .background(.purple)
        .foregroundColor(.white)
        .cornerRadius(10)
    })
    // iOS 15..
    Button(action: {}, label: {
      Text(">= iOS 15")
      
    })
    // 颜色
    .tint(.purple)
    // 样式:醒目
    .buttonStyle(.borderedProminent)
    
    // 圆角矩形
    .buttonBorderShape(.roundedRectangle(radius: 15))
    // 大小 large small mini regular
    .controlSize(.large)
    
    Button(action: {}, label: {
      Text(">= iOS 15")
    })
    .tint(.purple)
    .buttonStyle(.bordered)
    .buttonBorderShape(.capsule)
    .controlSize(.large)
  }
}

#Preview {
  IOS15ButtonStyleAPI()
}
